#include "stdafx.h"
#include "tag_info.h"

namespace SimpleGUI
{
	// Constructor and Destructor

	tag_info::tag_info(unsigned int i, unsigned int w)
	{
		put_linear_index(i, w);
	};

	tag_info::~tag_info()
	{
	};

	// Accessor Functions

	inline unsigned int tag_info::get_linear_index()
	{
		return linear_index;
	};

	inline void tag_info::put_linear_index(unsigned int i, unsigned int w)
	{
		linear_index=i;
		wrap_around=w;
		calc_cartesian_index();
	};

	inline void tag_info::put_cartesian_index(unsigned int r, unsigned int c)
	{
		row_index=r;
		column_index=c;
		calc_linear_index();
	};

	inline unsigned int tag_info::get_wrap_around()
	{
		return wrap_around;
	};

	inline unsigned int tag_info::get_row_index()
	{
		return row_index;
	};

	inline unsigned int tag_info::get_column_index()
	{
		return column_index;
	};

	// Worker Functions

	void tag_info::calc_cartesian_index()
	{
		row_index=linear_index / wrap_around;
		column_index=linear_index % wrap_around;
	};

	void tag_info::calc_linear_index()
	{
		linear_index=(row_index * wrap_around) + column_index;
	};
}
